#include "netserver.h"

#include <iostream>

int main(int argc, char **argv)
{
    if (argc < 2)
    {
        std::cerr << "Usage: serverChat <port> \n";
        return 1;
    }

    try
    {
        unsigned short l_port(std::atoi(argv[1]));
        NetServer chatserver(l_port);
        std::cout << "Creation of Chat server on port " << l_port << std::endl;
        NetService::run();
    }
    catch (std::exception& e)
    {
      std::cerr << "Exception: " << e.what() << "\n";
    }
    std::cout << "Server ended" << std::endl;
    return 0;
}
